1. Field of the Invention
This invention relates to a frequency subband encoding apparatus, and more particularly to a frequency subband encoding apparatus wherein mask levels for individual frequency subbands are calculated from a digital audio signal based on a psychoacoustic model and signal levels of the individual frequency subbands are detected from samples of the individual frequency subbands, and then signal to mask level ratios which are ratios of the signal levels and the mask levels are calculated for the individual frequency subbands and bit allocation amounts for the individual frequency subbands are determined from the signal to mask level ratios, whereafter samples of the individual frequency subbands are quantized with quantization step numbers determined from the bit allocation amounts.
2. Description of the Related Art
As an example of a conventional frequency subband encoding apparatus, a frequency subband encoding apparatus is described in the ISO/IEC 11172-3 standards (hereinafter referred to as "MPEG/Audio system"), Layer 1.
FIG. 5 shows in block diagram the conventional frequency subband encoding apparatus. Referring to FIG. 5, the frequency subband encoding apparatus includes a subband filter 1, a scale factor determinator 2, a quantizer 3, an SMR calculator 4 for outputting, for each of frequency subbands, a signal to mask level ratio (hereinafter referred to as SMR) which is a ratio between a signal level of the frequency subband and a mask level for the frequency subband based a psychoacoustic model, a bit allocator 15 for determining a bit allocation amount, and a multiplexer 6.
The subband filter 1 outputs values of a PCM (Pulse Code Modulation) signal 7 divided into 32 frequency subbands. The sampling frequency of the output signal of the PCM signal 7 is equal to 1/32 the sampling frequency of the PCM signal 7. The scale factor determinator 2 determines, from an output value of each of the frequency subbands of the subband filter 1, and outputs a scale factor for use to perform normalization for each 12 samples of the frequency subband. The SMR calculator 4 calculates a mask level for each of the individual frequency subbands from the PCM signal 7 based on a psychoacoustic model, calculates a signal level from samples of each of the frequency subbands and the corresponding scale factor, and calculates and outputs, for each frequency subband, a ratio (SMR) between the signal level and the mask level, which is a ratio between the two levels. The bit allocator 15 determines a bit allocation amount for each of the frequency subband from the SMR of the frequency subband. The quantizer 3 quantizes, with the bit allocation amount and the scale factor for each of the frequency subbands, samples of the frequency subband and outputs the thus quantized samples. The multiplexer 6 multiplexes the bit allocation information from the bit allocator 15, the scale factors from the scale factor determinator 2 and the quantized values from the quantizer 3 and outputs a bit stream 8.
The number of bits included in one frame of the "MPEG/Audio Layer 1" system depends upon the values of the bit rate and the sampling frequency. As an example, when the bit rate is 192 kbps and the sampling frequency is 48 kHz, the number of bits of one frame is 1,536 bits in accordance with the standards mentioned above.
The structure of one frame of the "MPEG/Audio Layer 1" system includes, for example, as shown in FIG. 6, factors of a header, a CRC (Cyclic Redundancy Code), a bit allocation, a scale factor, a sample and an ancillary bit.
The header normally includes 32 bits, and the bit allocation requires 4 bits for each frequency subband and totally requires 128 (4.times.32) bits/ch. The other factors vary depending upon conditions. The header includes a bit representing whether or not a CRC is present. When a CRC is present, 16 bits are required for the CRC. The scale factor requires, when the bit allocation to each frequency subband is not equal to 0, 6 bits for each frequency subband. The sample requires, when the bit allocation to each frequency subband is not equal to 0, 12 bits for each one bit of the bit allocation. The ancillary bit includes bits provided by a number equal to the remaining number when a total number of bits mentioned above is subtracted from a total bit number of one frame.
A maximum bit number allocated by bit allocation processing exhibits a maximum value when the ancillary bit is not allocated intentionally without a CRC. The total bit number of the scale factor and the sample which is an allocatable bit number of one frame in the aforementioned case wherein the bit rate is 192 kbps and the sampling frequency is 48 kHz is 1,376 (1,536-(32+128)) bits.
The relationship between the allocated bit number for each of the frequency subbands and the signal to noise ratio (S/N ratio) which depends upon the allocated bit number is illustrated in FIG. 7. The bit numbers allocated to the frequency subband range from 0 to 15 bits except one bit (not shown in FIG. 7).
FIG. 8 is a flow chart illustrating bit allocation processing of the conventional frequency subband encoding apparatus shown in FIG. 5. While the MPEG/Audio system allows encoding of up to 2 channels, description is given here of bit allocation processing for one channel. At step P1, a frequency subband which exhibits a maximum SMR among SMR values of the 32 frequency subbands is detected, and the allocated bit number of the frequency subband is increased by one step (FIG. 7) and a new SMR is detected in accordance with the thus increased bit number. When bits are allocated to the frequency subband at first (when 2 bits are allocated to the frequency subband to which 0 bit has been allocated in FIG. 5), totaling 30 bits are allocated including 6 bits allocated to the scale factor and 24 bits allocated to the sample (2.times.12=24 since the audio signal is sectioned into 12 samples with respect to the time base in one frame). As a result, if the thus allocated bit number becomes equal to 15 bits (maximum bits in FIG. 7) which are a limit value, then the frequency subband is removed from the object of comparison processing of the SMR so that no allocation processing may occur later with the frequency subband. When bits are to be allocated to any frequency subband to which bits (two or more bits) have been allocated already, only 12 bits (1.times.12) are allocated to the sample. The thus allocated bit number is subtracted from the allocatable bit number.
At step P2, it is discriminated whether or not the allocatable bit number is equal to or greater than 30, and if the allocatable bit number is equal to or greater than 30, then the control sequence returns to step P1. On the contrary if the allocatable bit number is smaller than 30, the control sequence advances to step P3. At step P3, it is discriminated whether or not the allocatable bit number is smaller than 12. If the allocatable bit number is smaller than 12, then the processing is ended. However, if the allocatable bit number is equal to or greater than 12, then the control sequence advances to step P4. At step P4, frequency subbands to which bits have not been allocated are removed from the object of comparison processing of the SMR so that allocation processing may not occur later with the frequency subbands.
Then at step P5, a frequency subband which exhibits a maximum SMR among the SMR values of the 32 frequency subbands is detected, and the allocated bit number of the frequency subband is increased by one step. As a result, if the allocated bit number becomes equal to 15 which is the limit value, then the frequency subband is removed from the object of comparison processing of the SMR so that allocation processing may not thereafter occur with the frequency subband. Further, the allocated bit number is subtracted from the allocatable bit number. Then at step P6, it is discriminated whether or not the allocatable bit number is equal to or greater than 12. If the allocatable bit number is equal to or greater than 12, then the control sequence returns to step P5. However, if the allocatable bit number is smaller than 12, then the processing is ended.
Comparison processing for repeating a fixed number of processing operations is included in each of the processing operations at steps P1, P4 and P5. Such processing can be reduced by describing a same process in series by a necessary number of times. Therefore, the numbers of times of comparison processing operations at the individual processing operations except repetitive processing operations of the fixed numbers are such as illustrated in FIG. 9.
The condition wherein the bit allocation processing amount described above exhibits a maximum value is the case wherein the number of repetitions from step P1 to step P2 exhibits a maximum value. This because, since the bit allocation is one-sided to a certain frequency subbands, the bit number of the scale factor is reduced while the bit number of the sample is increased and consequently the processing number of times from step P1 to step P2 exhibits a maximum value. In the case described above wherein the bit rate is 192 kbps and the sampling frequency is 48 kHz, the repetition number exhibits a maximum value when 14 bits are allocated to the frequency subbands 0 to 5, 13 bits are allocated to the frequency subbands 6 to 7 and 0 bits are allocated to the other frequency subbands.
As an example which includes such bit allocation as described above, in such SMR values as illustrated in FIG. 10, the processing operations from step P1 to step P2 are repetitively executed by 101 times, and the processing operations from step P5 to step P6 are executed once. As a result, comparison processing occurs by a total number of 3,501 times. The bit allocator 15 which performs such bit allocation processing as described above in the conventional frequency subband encoding apparatus of FIG. 5 is realized, for example, using a microprocessor.
In the conventional frequency subband encoding apparatus described above, the processing of the bit allocator includes a large number of comparison processing operations. Therefore, the conventional frequency subband encoding apparatus is disadvantageous in that, in order to encode an audio signal on the predetermined real time basis, a microprocessor and other hardware elements having a high processing capacity are required and a very high cost is required for the apparatus.